const http= require('http');
const url= require('url');
const model=require('./model/model')
// model.login(1,2)
http.createServer(function (req, res) { 
    res.writeHead(200,'Content-Type:text/html;charset="utf8"')
    var pathname=url.parse(req.url,true).pathname.replace('/','')
    console.log(pathname)
    if (pathname!=='favicon.ico') {  
        try {
            model[pathname](req, res);
        } catch (error) {
            model['home'](req, res);
            
        }      
        
    }
}).listen(8081);